<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>仪器共享</title>
<meta name="keywords" content="科研仪器，生命科学仪器，环境检测仪器，实验常用设备，分析仪器">
<meta name="description"
	content="中国领先的科研仪器共享平台，让您快速找到各种类型的科学研究仪器。提升闲置仪器利用率，产生更大科研价值。涵盖：生命科学仪器、环境检测仪器、实验常用设备、分析仪器、仪表、物性测试、测量/计量仪器、在线及过程控制仪器。">
<!--<link rel="stylesheet" href="new_css/header_footer.css?t=1">-->
<link rel="stylesheet" href="new_css/publishInstrument.css">
<link rel="stylesheet" href="new_css/userCenter.css">
<link rel="stylesheet" href="css/reset.css">
<script src="method/wf/pageSkip.js"></script>
<!-- <link rel="stylesheet" href="css/common.css">
 --><style>
.header-search-lef .shopping-Mall .logo-mall {
	margin-top: 34px;
}

.logo-mall.instrument-management {
	width: 74px;
	height: 24px;
	background: rgba(237, 23, 23, 1);
	border-radius: 2px;
	line-height: 20px;
	text-align: center;
}

.logo-mall.instrument-management a {
	font-size: 14px;
	color: #fff;
}
</style>
<style>
.mainList .content {
	width: 100%;
	display: inline-block;
	height: 1079px;
}
</style>
<script src="js/jquery-1.11.3.js"></script>
<script>
	$(function() {

		$('#front_header .header_wrap .right').hover(function() {
			$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon2.png');
			$('#front_header .header_wrap .right .out').show();
		}, function() {
			$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon1.png');
			$('#front_header .header_wrap .right .out').hide();
		});

		//-----
		$("#item2").mouseover(function() {
			$(".item2_ul").css("display", "block");
		});


		$("#item2").mouseout(function() {
			$(".item2_ul").css("display", "none");
		});


		//----
		//				$('#item2').on('mouseover',function() {
		//					console.log("111111");
		//					$('#item2_ul').css('display','block');
		//				}
		//				$('#item2').on('mouseout',function() {
		//					$('#item2_ul').css('display', 'none');
		//				}

		$('#sorts').on('mouseover', 'li', function() {
			$(this).find('span img').attr('src', 'images/icon4.png');
		});
		$('#sorts').on('mouseout', 'li', function() {
			$(this).find('span img').attr('src', 'images/icon5.png');
		});

		$('.mainList .content .left li').click(function() {
			$(this).addClass('selected').siblings().removeClass('selected');
		});
	});
</script>
<script>
	$(function() {
		$('#front_header .header_wrap .right').hover(function() {
			$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon2.png');
			$('#front_header .header_wrap .right .out').show();
		}, function() {
			$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon1.png');
			$('#front_header .header_wrap .right .out').hide();
		});
		$('#sorts').on('mouseover', 'li', function() {
			$(this).find('span img').attr('src', 'images/icon4.png');
		});
		$('#sorts').on('mouseout', 'li', function() {
			$(this).find('span img').attr('src', 'images/icon5.png');
		});
		$('.mainList .content .left li').click(function() {
			$('.mainList .content .left li').removeClass('selected');
			$(this).addClass('selected');
		});
		$('.mainList .content .left .list_header').click(function() {
			if ($('.mainList .content .left .secendList').is(':hidden')) {
				$('.mainList .content .left .secendList').slideDown();
				$('.mainList .content .left .list_header img').attr("src", "images/insUser_icon.png");
			} else {
				$('.mainList .content .left .secendList').slideUp();
				$('.mainList .content .left .list_header img').attr("src", "images/icon4.png");
			}
			;

		});
		$('.mainList .content .left .list_header1').click(function() {
			if ($('.mainList .content .left .secendList1').is(':hidden')) {
				$('.mainList .content .left .secendList1').slideDown();
				$('.mainList .content .left .list_header1 img').attr("src", "images/insUser_icon.png");
			} else {
				$('.mainList .content .left .secendList1').slideUp();
				$('.mainList .content .left .list_header1 img').attr("src", "images/icon4.png");
			}
			;

		});
	});
</script>
<script>
	$(function() {
		$('#front_header .header_wrap .right').hover(function() {
			$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon2.png');
			$('#front_header .header_wrap .right .out').show();
		}, function() {
			$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon1.png');
			$('#front_header .header_wrap .right .out').hide();
		});
		$('#sorts').on('mouseover', 'li', function() {
			$(this).find('span img').attr('src', 'images/icon4.png');
		});
		$('#sorts').on('mouseout', 'li', function() {
			$(this).find('span img').attr('src', 'images/icon5.png');
		});

		$('.mainList .content .left li').click(function() {
			$(this).addClass('selected').siblings().removeClass('selected');
		});
		//				$(".mainList .content .right table td input").each(function(){
		//					var index=$(this).parents('tr').index();
		//					$(this).attr('id','select'+index);
		//					$(this).siblings('label').attr('for','select'+index);
		//				});
		$(".mainList .content .right table td label").click(function() {
			if ($(this).siblings('input').is(':checked')) {
				$(this).find('img').attr('src', 'images/icon35.png');
				$(this).siblings('input').prop('checked', false);
			} else {
				$(this).find('img').attr('src', 'images/icon36.png');
				$(this).siblings('input').prop('checked', true);
			}
			;
		});

	});
</script>
</head>
<body style="background:#fff;">

	<!--header-->
	<%@include file="/header5.jsp"%>
	<div class="mainList">
		<div class="content">
			<div class="left">
				<div class="title">仪器管理</div>
				<input id="organizationId" type="hidden" value="<%=session.getAttribute("id") %>" >
				<!--<div class="list_header">全部订单<img src="images/usercenter_icon.png" /></div>-->

				<!--<div class="sun_title ">已回复</div>-->
				<!--<div class="sun_title activity">未回复</div>-->


				<ul class="ninu" style="text-align: center">
						<li onclick="li1()" style="text-align: center">仪器管理人员维护</li>
						<li onclick="li2()" style="text-align: center">服务审核</li>
						<li onclick="li3()" style="text-align: center">仪器发布查询</li>
					</ul>

					<ul class="ninu" >	
						<li style="text-align: center" class="list_header">统计分析<img src="images/insUser_icon.png" /></li>
					</ul>
					<ul class="secendList" id="cbdsiac">
						<li onclick="li4()">仪器使用情况分析</a></li>
						<li onclick="li5()">月度经营收入分析</li>
						<li onclick="li6()">预约处理效率分析</li>
						<li onclick="li7()">违约率统计分析</li>
						<li onclick="li8()">用户评价统计分析</li>
					</ul>

				<!--<script type="text/javascript">-->
				<!--window.onload = function(){-->
				<!--var secendList = document.getElementById("secendList");-->
				<!--secendList.onclick = function(event){-->
				<!--event.preventDefault();-->
				<!--console.log(event.target.innerText);-->
				<!--console.log(event.target.nodeName);-->
				<!--}-->
				<!--}-->
				<!--</script>-->

				<script>
					var ul = document.getElementById('secendList');
					var lis = ul.getElementsByTagName('li');
					for (var i = 0; i < lis.length; i++) {
						lis[i].onclick = function() {
							document.getElementById("span1").innerHTML = this.innerHTML;
						}
					}
				</script>
			</div>
			<style>
.mainList .content .right {
	padding-top: 18px;
}

.mainList .content .right .title .title_btn {
	margin-top: -10px;
}

.search-input input#aiya {
	width: 208px;
	height: 46px;
	border: 1px solid #D3D3D3;
	border-radius: 0px;
}

.search-input input#wohenhou {
	width: 102px;
	height: 46px;
	background: rgba(255, 138, 0, 1);
	color: #ffffff;
	border-radius: 0px;
	margin-left: -5px;
	border: 1px solid rgba(255, 138, 0, 1);
}

.select-download-nav {
	margin-left: 20px;
}

.select-download-nav select#moni {
	width: 208px;
	height: 46px;
	border: 1px solid #D3D3D3;
	border-top-left-radius: 0px !important;
}

.select-download-nav input#bgf {
	width: 102px;
	height: 46px;
	background: rgba(255, 138, 0, 1);
	color: #ffffff;
	border-radius: 0px;
	margin-left: -9px;
	border: 1px solid rgba(255, 138, 0, 1);
}
</style>
			<div class="right">
				<div class="title">
					<span id="span1">发布仪器</span>
					<div class="title_btn">
						<div class="search-input fl">
							<input id="aiya" type="text"> <input id="wohenhou" type="submit" value="搜索">
						</div>
						<div class="select-download-nav fl">
							<select id="moni">
								<option data-appid="">选择仪器管理人员</option>
							</select> <input id="bgf" type="submit" value="分配仪器" onclick="update();">
						</div>
					</div>
				</div>
				<table id="cList">
					<tr>
						<th></th>
						<th>序号</th>
						<th>名称</th>
						<th>价格</th>
						<th>仪器负责人</th>
						<th>发布状态</th>
						<th>操作</th>
					</tr>
				</table>
			</div>
		</div>
	</div>
	<style>
	.myPage {
		margin: 0 auto;
		width: 900px;
		height: 80px;
		font-size: 12px;
		float: right;
		float: right;
	}

	.mainList .content .left {
	width: 192px;
	float: left;
	border: 1px solid #d3d3d3;
	height: 100%;
	min-height: 1067px;
	text-align: center;
	padding-bottom: 18px;
	}
	</style>

	<!--page-->
	<div class="myPage clearfix">
	<!--currentpage="1" numbercount="100"-->
	<ul class="page" maxshowpageitem="5" pagelistcount="10"  id="page"></ul>
	</div>

	<!--footer-->
	<footer>
		<div class="foot clearfix">
			<p>&copy; 2015-2020 科研仪器 版权所有 技术支持：科研仪器共享平台 支持电话：010-123658987</p>
		</div>
	</footer>
	<script src="js/jquery-1.11.3.js"></script>
	<script src="js/new_js/common.js"></script>
	<script>
		$(document).ready(function(){
			var offset = 0;
			getControlUser();
			getControl(offset);
			$('#wohenhou').click(function(){
				MyObjectLoad();
			})
		})
		
		MyObject = {
			//url:'http://localhost/user/sum/getControl',
			url:Server + "/user/sum/updateControl",
			ishavesend: 0 ,
			boolean : false,
			type:"POST",
			dataType : "JSON",
			number : 1,
			AllCount : 0,
			nowp : 0,
			Callback : function(nowPage){
				MyObject.nowp = nowPage;
				getControl(MyObject.nowp -1);
			}
		};
		
		function MyObjectLoad(){
			var name = $('#aiya').val();
			var id = organizationId
			$('#page').initPage((function(){
				$.ajax({
					url:MyObject.url,
					type:MyObject.type,
					dataType:MyObject.dataType,
					async:MyObject.boolean,
					data:{
						offset:MyObject.number,
						limit:MyObject.number,
						name:name,
						ouId:id,
					},
					success : function(data){
						MyObject.AllCount = data.total;
					}
				});
				return MyObject.AllCount;
			})(),MyObject.number,MyObject.Callback);
		}
		MyObjectLoad();
		
		function update(){
			var control = [];
			for(var i = 0;i < $('.insInfoId[src="images/icon36.png"]').length;i++){
				control.push($('.insInfoId[src="images/icon36.png"]').eq(i).attr("data-appid"));
			}
			var user = $('#moni option:selected').attr("data-appid");
			if(control.length == 0){
				alert("请至少选择一个仪器来进行分配");
				return;
			}
			if(user == ''){
				alert("请选择要分配的仪器管理人员");
				return;
			}
			$.ajax({
				//url:"http://localhost/user/sum/updateControl",
				url:Server + '/user/sum/updateControl',
				data:{
					cuId : control.join(),
					id : user,
				},
				type:"POST",
				dataType:"json",
				success : function(data){
					if(data == 0){
						alert("分配失败");
					}else if(data == 1){
						alert("分配成功");
						getControl(0);
					}
				},
				error : function(msg){
					alert("操作异常");
				}
			})
		}
		
		function getControl(offset){
			var id= organizationId
			var name = $('#aiya').val();
			$.ajax({
				//url:'http://localhost/user/sum/getControl',
				url:Server + '/user/sum/getControl',
				data:{
					ouId:id,
					limit:10,
					offset:offset,
					name:name,
				},
				type:"POST",
				dataType:"json",
				success : function(data){
					var html = "";
					var top = '<tr>\
						<th></th>\
						<th>序号</th>\
						<th>名称</th>\
						<th>价格</th>\
						<th>仪器负责人</th>\
						<th>状态</th>\
						<th>操作</th>\
					</tr>';
					var pattren = '<tr>\
						<td><input type="checkbox" name="" value=""/> <label><img class="insInfoId" src="images/icon35.png" data-appid="#6"/></label></td>\
						<td>#0</td>\
						<td>#1</td>\
						<td>#2元/小时</td>\
						<td>#3</td>\
						<td>#4</td>\
						<td><a href="lizisepuyimy16-8?infoid=#5">查看</a></td>\
					</tr>';
					var param = data.rows;
					var j = 1;
					for(var i = 0 ; i < param.length;i++){
						var item = '';
						var state = '';
						var chineseName = '';
						var total = 0;
						var realname = '';
						if(param[i].insStatus != undefined){
							if(param[i].insStatus == 0){
								state = '正常';
							}else if(param[i].insStatus == 1){
								state = '损坏';
							}else if(param[i].insStatus == 2){
								state = '需更换耗材';
							}
						}
						if(param[i].chineseName != undefined){
							chineseName = param[i].chineseName;
						}
						if(param[i].total != undefined){
							total = param[i].total;
						}
						if(param[i].conUser != undefined){
							if(param[i].conUser.realname != undefined){
								realname = param[i].conUser.realname;
							}
						}
						item += pattren
							.replace("#0",j)
							.replace("#1",chineseName)
							.replace("#2",total)
							.replace("#3",realname)
							.replace("#4",state)
							.replace("#5",param[i].id)
							.replace("#6",param[i].id),
						html += item;
						j++;
					}
					html = top + html;
					$('#cList').html(html);
					$(".mainList .content .right table td label").click(function() {
						if ($(this).siblings('input').is(':checked')) {
							$(this).find('img').attr('src', 'images/icon35.png');
							$(this).siblings('input').prop('checked', false);
						} else {
							$(this).find('img').attr('src', 'images/icon36.png');
							$(this).siblings('input').prop('checked', true);
						}
					});
				}
			})
		}
		
		function getControlUser(){
			var id= organizationId
			$.ajax({
				url:Server + '/user/sum/getControlUser',
				//url:'http://localhost/user/sum/getControlUser',
				data:{
					uId:id,
				},
				type:"POST",
				dataType:"json",
				success : function(data){
					var html = "";
					var pattren = '<option data-appid="#1">#0</option>';
					var top = '<option data-appid="">选择仪器管理人员</option>';
					for(var i = 0;i < data.length;i++){
						var param = data[i];
						var item = '';
						item += pattren
							.replace("#0",param.realname)
							.replace("#1", param.uId),
						html += item;
					}
					html = top + html;
					$('#moni').html(html);
				}
			})
		}
	</script>
</body>
<style type="text/css">
.mainList .content .right table {
    margin-top: 14px;
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d3d3d3;
    height: 45px;
    box-shadow: 0 0 10px 2px rgba(254,244,232,0.8);
}
	tr {
    /* width: 70px; */
    height: 70px;
}

.mainList .content {
    width: 100%;
    display: inline-block;
    height: 900px;
}

.mainList .content .left {
    width: 192px;
    float: left;
    border: 1px solid #d3d3d3;
    /* height: 100%; */
    height: 900px;
    /* min-height: 1000px; */
    text-align: center;
}

.mainList .content .right {
    width: 950px;
    float: right;
    /* height: 100%; */
    height: 882px;
    /* min-height: 1000px; */
    padding: 0 20px;
    border: 1px solid #d3d3d3;
}

.mainList .content {
    width: 1200px;
    height: 920px;
    margin-bottom: 30px;
}
.mainList .content .right .title {
    width: 100%;
    height: 60px;
    border-bottom: 1px solid #d3d3d3;
    line-height: 44px;
    font-size: 18px;
    color: #202020;
}
.search-input.fl {
    margin-top: 17px;
}
.select-download-nav.fl {
    margin-top: 17px;
}
.search-input input#wohenhou {
    width: 102px;
    height: 47px !important;
    background: rgba(255, 138, 0, 1);
    color: #ffffff;
    border-radius: 0px;
    margin-left: -10px;
    border: 1px solid rgba(255, 138, 0, 1);
}
.myPage {
    /* margin: 0 auto; */
    width: 529px;
    height: 80px;
    font-size: 12px;
    float: right;
}

.mainList .content .right {
    width: 950px;
    float: right;
    height: 100%;
    min-height: 900px !important;
    padding: 0 20px;
    border: 1px solid #d3d3d3;
}
.mainList .content .left {
    width: 192px;
    float: left;
    border: 1px solid #d3d3d3;
    height: 100%;
    min-height: 900px !important;
    text-align: center;
}

</style>


</html>
